<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Vis Documentation &mdash; PyAMG v1.0 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '1.0',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="top" title="PyAMG v1.0 documentation" href="index.html" />
    <link rel="up" title="Pyamg Documentation" href="pyamg.html" />
    <link rel="next" title="Krylov Documentation" href="pyamg.krylov.html" />
    <link rel="prev" title="Pyamg Documentation" href="pyamg.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="pyamg.krylov.html" title="Krylov Documentation"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="pyamg.html" title="Pyamg Documentation"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">PyAMG v1.0 documentation</a> &raquo;</li>
          <li><a href="modules.html" accesskey="U">Project Documentation</a> &raquo;</li>
          <li><a href="pyamg.html" accesskey="U">Pyamg Documentation</a> &raquo;</li> 
      </ul>
    </div>  
    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  
  <div class="section" id="vis-documentation">
<h1>Vis Documentation<a class="headerlink" href="#vis-documentation" title="Permalink to this headline">¶</a></h1>
<p>This page contains the Vis Package documentation.</p>
<div class="section" id="module-pyamg.vis.vis_coarse">
<h2>The <tt class="xref docutils literal"><span class="pre">vis_coarse</span></tt> Module<a class="headerlink" href="#module-pyamg.vis.vis_coarse" title="Permalink to this headline">¶</a></h2>
<p>Visualization tools for coarse grids, both C/F splittings and aggregation.</p>
<p>Output is either to file (VTK) or to the screen (matplotlib).</p>
<p>vis_splitting:        visualize C/F splittings through vertex elements
vis_aggregate_groups: visualize aggregation through groupins of edges, elements</p>
<dl class="function">
<dt id="pyamg.vis.vis_coarse.vis_splitting">
<!--[pyamg.vis.vis_coarse.vis_splitting]--><tt class="descclassname">pyamg.vis.vis_coarse.</tt><tt class="descname">vis_splitting</tt><big>(</big><em>Verts</em>, <em>splitting</em>, <em>output='vtk'</em>, <em>fname='output.vtu'</em><big>)</big><a class="headerlink" href="#pyamg.vis.vis_coarse.vis_splitting" title="Permalink to this definition">¶</a></dt>
<dd><p>Coarse grid visualization for C/F splittings.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>Verts</strong> : {array}</p>
<blockquote>
<p>coordinate array (N x D)</p>
</blockquote>
<p><strong>splitting</strong> : {array}</p>
<blockquote>
<p>coarse(1)/fine(0) flags</p>
</blockquote>
<p><strong>fname</strong> : {string, file object}</p>
<blockquote>
<p>file to be written, e.g. &#8216;output.vtu&#8217;</p>
</blockquote>
<p><strong>output</strong> : {string}</p>
<blockquote>
<p>&#8216;vtk&#8217; or &#8216;matplotlib&#8217;</p>
</blockquote>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><strong>- Displays in screen or writes data to .vtu file for use in paraview (xml 0.1 format)</strong> :</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<dl class="docutils">
<dt>D <span class="classifier-delimiter">:</span> <span class="classifier"></span></dt>
<dd>dimension of coordinate space</dd>
<dt>N <span class="classifier-delimiter">:</span> <span class="classifier"></span></dt>
<dd># of vertices in the mesh represented in Verts</dd>
<dt>Ndof <span class="classifier-delimiter">:</span> <span class="classifier"></span></dt>
<dd><p class="first"># of dof (= ldof * N)</p>
<ul class="last simple">
<li>simply color different points with different colors.  This works 
best with classical AMG.</li>
<li>writes a file (or opens a window) for each dof</li>
<li>for Ndof&gt;1, they are assumed orderd [...dof1..., ...dof2..., etc]</li>
</ul>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">import</span> <span class="nn">numpy</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">pyamg.vis.vis_coarse</span> <span class="k">import</span> <span class="n">vis_splitting</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Verts</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mf">0.0</span><span class="p">,</span><span class="mf">0.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">1.0</span><span class="p">,</span><span class="mf">0.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">0.0</span><span class="p">,</span><span class="mf">1.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">1.0</span><span class="p">,</span><span class="mf">1.0</span><span class="p">]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">splitting</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0</span><span class="p">,</span><span class="mf">1</span><span class="p">,</span><span class="mf">0</span><span class="p">,</span><span class="mf">1</span><span class="p">,</span><span class="mf">1</span><span class="p">,</span><span class="mf">0</span><span class="p">,</span><span class="mf">1</span><span class="p">,</span><span class="mf">0</span><span class="p">])</span>    <span class="c"># two variables</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">vis_splitting</span><span class="p">(</span><span class="n">Verts</span><span class="p">,</span><span class="n">splitting</span><span class="p">,</span><span class="n">output</span><span class="o">=</span><span class="s">&#39;vtk&#39;</span><span class="p">,</span><span class="n">fname</span><span class="o">=</span><span class="s">&#39;output.vtu&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">pyamg.classical</span> <span class="k">import</span> <span class="n">RS</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">pyamg.vis.vis_coarse</span> <span class="k">import</span> <span class="n">vis_splitting</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">pyamg.gallery</span> <span class="k">import</span> <span class="n">load_example</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">data</span> <span class="o">=</span> <span class="n">load_example</span><span class="p">(</span><span class="s">&#39;unit_square&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;A&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tocsr</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">V</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;vertices&#39;</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">E2V</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;elements&#39;</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">splitting</span> <span class="o">=</span> <span class="n">RS</span><span class="p">(</span><span class="n">A</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">vis_splitting</span><span class="p">(</span><span class="n">Verts</span><span class="o">=</span><span class="n">V</span><span class="p">,</span><span class="n">splitting</span><span class="o">=</span><span class="n">splitting</span><span class="p">,</span><span class="n">output</span><span class="o">=</span><span class="s">&#39;vtk&#39;</span><span class="p">,</span><span class="n">fname</span><span class="o">=</span><span class="s">&#39;output.vtu&#39;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="pyamg.vis.vis_coarse.vis_aggregate_groups">
<!--[pyamg.vis.vis_coarse.vis_aggregate_groups]--><tt class="descclassname">pyamg.vis.vis_coarse.</tt><tt class="descname">vis_aggregate_groups</tt><big>(</big><em>Verts</em>, <em>E2V</em>, <em>Agg</em>, <em>mesh_type</em>, <em>output='vtk'</em>, <em>fname='output.vtu'</em><big>)</big><a class="headerlink" href="#pyamg.vis.vis_coarse.vis_aggregate_groups" title="Permalink to this definition">¶</a></dt>
<dd><p>Coarse grid visualization of aggregate groups.  Create .vtu files for use
in Paraview or display with Matplotlib</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>Verts</strong> : {array}</p>
<blockquote>
<p>coordinate array (N x D)</p>
</blockquote>
<p><strong>E2V</strong> : {array}</p>
<blockquote>
<p>element index array (Nel x Nelnodes)</p>
</blockquote>
<p><strong>Agg</strong> : {csr_matrix}</p>
<blockquote>
<p>sparse matrix for the aggregate-vertex relationship (N x Nagg)</p>
</blockquote>
<p><strong>mesh_type</strong> : {string}</p>
<blockquote>
<p>type of elements: vertex, tri, quad, tet, hex (all 3d)</p>
</blockquote>
<p><strong>fname</strong> : {string, file object}</p>
<blockquote>
<p>file to be written, e.g. &#8216;output.vtu&#8217;</p>
</blockquote>
<p><strong>output</strong> : {string}</p>
<blockquote>
<p>&#8216;vtk&#8217; or &#8216;matplotlib&#8217;</p>
</blockquote>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>- Writes data to .vtu file for use in paraview (xml 0.1 format) or</strong> :</p>
<blockquote class="last">
<p>displays to screen using matplotlib</p>
</blockquote>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Works for both 2d and 3d elements.  Element groupings are colored
with data equal to 2.0 and stringy edges in the aggregate are colored
with 3.0</li>
</ul>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">pyamg.aggregation</span> <span class="k">import</span> <span class="n">standard_aggregation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">vis_coarse</span> <span class="k">import</span> <span class="n">vis_aggregate_groups</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">pyamg.gallery</span> <span class="k">import</span> <span class="n">load_example</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">data</span> <span class="o">=</span> <span class="n">load_example</span><span class="p">(</span><span class="s">&#39;unit_square&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;A&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tocsr</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">V</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;vertices&#39;</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">E2V</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;elements&#39;</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Agg</span> <span class="o">=</span> <span class="n">standard_aggregation</span><span class="p">(</span><span class="n">A</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">vis_aggregate_groups</span><span class="p">(</span><span class="n">Verts</span><span class="o">=</span><span class="n">V</span><span class="p">,</span> <span class="n">E2V</span><span class="o">=</span><span class="n">E2V</span><span class="p">,</span> <span class="n">Agg</span><span class="o">=</span><span class="n">Agg</span><span class="p">,</span> <span class="n">mesh_type</span><span class="o">=</span><span class="s">&#39;tri&#39;</span><span class="p">,</span> <span class="n">output</span><span class="o">=</span><span class="s">&#39;vtk&#39;</span><span class="p">,</span> <span class="n">fname</span><span class="o">=</span><span class="s">&#39;output.vtu&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">pyamg.aggregation</span> <span class="k">import</span> <span class="n">standard_aggregation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">vis_coarse</span> <span class="k">import</span> <span class="n">vis_aggregate_groups</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">from</span> <span class="nn">pyamg.gallery</span> <span class="k">import</span> <span class="n">load_example</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">data</span> <span class="o">=</span> <span class="n">load_example</span><span class="p">(</span><span class="s">&#39;unit_cube&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;A&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tocsr</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">V</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;vertices&#39;</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">E2V</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;elements&#39;</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Agg</span> <span class="o">=</span> <span class="n">standard_aggregation</span><span class="p">(</span><span class="n">A</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">vis_aggregate_groups</span><span class="p">(</span><span class="n">Verts</span><span class="o">=</span><span class="n">V</span><span class="p">,</span> <span class="n">E2V</span><span class="o">=</span><span class="n">E2V</span><span class="p">,</span> <span class="n">Agg</span><span class="o">=</span><span class="n">Agg</span><span class="p">,</span> <span class="n">mesh_type</span><span class="o">=</span><span class="s">&#39;tet&#39;</span><span class="p">,</span> <span class="n">output</span><span class="o">=</span><span class="s">&#39;vtk&#39;</span><span class="p">,</span> <span class="n">fname</span><span class="o">=</span><span class="s">&#39;output.vtu&#39;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

</div>
<div class="section" id="module-pyamg.vis.setup">
<h2>The <tt class="xref docutils literal"><span class="pre">setup</span></tt> Module<a class="headerlink" href="#module-pyamg.vis.setup" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="pyamg.vis.setup.configuration">
<!--[pyamg.vis.setup.configuration]--><tt class="descclassname">pyamg.vis.setup.</tt><tt class="descname">configuration</tt><big>(</big><em>parent_package=''</em>, <em>top_path=None</em><big>)</big><a class="headerlink" href="#pyamg.vis.setup.configuration" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div>
<div class="section" id="module-pyamg.vis.vtk_writer">
<h2>The <tt class="xref docutils literal"><span class="pre">vtk_writer</span></tt> Module<a class="headerlink" href="#module-pyamg.vis.vtk_writer" title="Permalink to this headline">¶</a></h2>
<p>VTK output functions.</p>
<p>Create coarse grid views and write meshes/primitives to .vtu files.  Use the
XML VTK format for unstructured meshes (.vtu)</p>
<p>This will use the XML VTK format for unstructured meshes, .vtu</p>
<p>See here for a guide:  <a class="reference" href="http://www.vtk.org/pdf/file-formats.pdf">http://www.vtk.org/pdf/file-formats.pdf</a></p>
<dl class="function">
<dt id="pyamg.vis.vtk_writer.write_vtu">
<!--[pyamg.vis.vtk_writer.write_vtu]--><tt class="descclassname">pyamg.vis.vtk_writer.</tt><tt class="descname">write_vtu</tt><big>(</big><em>Verts</em>, <em>Cells</em>, <em>pdata=None</em>, <em>pvdata=None</em>, <em>cdata=None</em>, <em>cvdata=None</em>, <em>fname='output.vtk'</em><big>)</big><a class="headerlink" href="#pyamg.vis.vtk_writer.write_vtu" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a .vtu file in xml format</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>fname</strong> : {string}</p>
<blockquote>
<p>file to be written, e.g. &#8216;mymesh.vtu&#8217;</p>
</blockquote>
<p><strong>Verts</strong> : {array}</p>
<blockquote>
<p>Ndof x 3 (if 2, then expanded by 0)
list of (x,y,z) point coordinates</p>
</blockquote>
<p><strong>Cells</strong> : {dictionary}</p>
<blockquote>
<p>Dictionary of with the keys</p>
</blockquote>
<p><strong>pdata</strong> : {array}</p>
<blockquote>
<p>Ndof x Nfields array of scalar values for the vertices</p>
</blockquote>
<p><strong>pvdata</strong> : {array}</p>
<blockquote>
<p>Nfields*3 x Ndof array of vector values for the vertices</p>
</blockquote>
<p><strong>cdata</strong> : {dictionary}</p>
<blockquote>
<p>scalar valued cell data</p>
</blockquote>
<p><strong>cvdata</strong> : {dictionary}</p>
<blockquote>
<p>vector valued cell data</p>
</blockquote>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><strong>writes a .vtu file for use in Paraview</strong> :</p>
</td>
</tr>
</tbody>
</table>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><tt class="xref docutils literal"><span class="pre">write_mesh</span></tt></p>
</div>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Poly data not supported</li>
<li>Non-Poly data is stored in Numpy array: Ncell x vtk_cell_info</li>
<li>Each I1 must be &gt;=3</li>
<li>pdata = Ndof x Nfields</li>
<li>pvdata = 3*Ndof x Nfields</li>
<li>cdata,cvdata = list of dictionaries in the form of Cells</li>
</ul>
<table border="1" class="docutils">
<colgroup>
<col width="13%" />
<col width="48%" />
<col width="33%" />
<col width="8%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">keys</th>
<th class="head">type</th>
<th class="head">n points</th>
<th class="head">dim</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>1</td>
<td>VTK_VERTEX:</td>
<td>1 point</td>
<td>2d</td>
</tr>
<tr><td>2</td>
<td>VTK_POLY_VERTEX:</td>
<td>n points</td>
<td>2d</td>
</tr>
<tr><td>3</td>
<td>VTK_LINE:</td>
<td>2 points</td>
<td>2d</td>
</tr>
<tr><td>4</td>
<td>VTK_POLY_LINE:</td>
<td>n+1 points</td>
<td>2d</td>
</tr>
<tr><td>5</td>
<td>VTK_TRIANGLE:</td>
<td>3 points</td>
<td>2d</td>
</tr>
<tr><td>6</td>
<td>VTK_TRIANGLE_STRIP:</td>
<td>n+2 points</td>
<td>2d</td>
</tr>
<tr><td>7</td>
<td>VTK_POLYGON:</td>
<td>n points</td>
<td>2d</td>
</tr>
<tr><td>8</td>
<td>VTK_PIXEL:</td>
<td>4 points</td>
<td>2d</td>
</tr>
<tr><td>9</td>
<td>VTK_QUAD:</td>
<td>4 points</td>
<td>2d</td>
</tr>
<tr><td>10</td>
<td>VTK_TETRA:</td>
<td>4 points</td>
<td>3d</td>
</tr>
<tr><td>11</td>
<td>VTK_VOXEL:</td>
<td>8 points</td>
<td>3d</td>
</tr>
<tr><td>12</td>
<td>VTK_HEXAHEDRON:</td>
<td>8 points</td>
<td>3d</td>
</tr>
<tr><td>13</td>
<td>VTK_WEDGE:</td>
<td>6 points</td>
<td>3d</td>
</tr>
<tr><td>14</td>
<td>VTK_PYRAMID:</td>
<td>5 points</td>
<td>3d</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">import</span> <span class="nn">numpy</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Verts</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mf">0.0</span><span class="p">,</span><span class="mf">0.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">1.0</span><span class="p">,</span><span class="mf">0.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">2.0</span><span class="p">,</span><span class="mf">0.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">0.0</span><span class="p">,</span><span class="mf">1.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">1.0</span><span class="p">,</span><span class="mf">1.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">2.0</span><span class="p">,</span><span class="mf">1.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">0.0</span><span class="p">,</span><span class="mf">2.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">1.0</span><span class="p">,</span><span class="mf">2.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">2.0</span><span class="p">,</span><span class="mf">2.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">0.0</span><span class="p">,</span><span class="mf">3.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">1.0</span><span class="p">,</span><span class="mf">3.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">2.0</span><span class="p">,</span><span class="mf">3.0</span><span class="p">]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">E2V</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mf">0</span><span class="p">,</span><span class="mf">4</span><span class="p">,</span><span class="mf">3</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">0</span><span class="p">,</span><span class="mf">1</span><span class="p">,</span><span class="mf">4</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">1</span><span class="p">,</span><span class="mf">5</span><span class="p">,</span><span class="mf">4</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">1</span><span class="p">,</span><span class="mf">2</span><span class="p">,</span><span class="mf">5</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">3</span><span class="p">,</span><span class="mf">7</span><span class="p">,</span><span class="mf">6</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">3</span><span class="p">,</span><span class="mf">4</span><span class="p">,</span><span class="mf">7</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">4</span><span class="p">,</span><span class="mf">8</span><span class="p">,</span><span class="mf">7</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">4</span><span class="p">,</span><span class="mf">5</span><span class="p">,</span><span class="mf">8</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">6</span><span class="p">,</span><span class="mf">10</span><span class="p">,</span><span class="mf">9</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">6</span><span class="p">,</span><span class="mf">7</span><span class="p">,</span><span class="mf">10</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">7</span><span class="p">,</span><span class="mf">11</span><span class="p">,</span><span class="mf">10</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">7</span><span class="p">,</span><span class="mf">8</span><span class="p">,</span><span class="mf">11</span><span class="p">]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">E2edge</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mf">0</span><span class="p">,</span><span class="mf">1</span><span class="p">]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">E2point</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">2</span><span class="p">,</span><span class="mf">3</span><span class="p">,</span><span class="mf">4</span><span class="p">,</span><span class="mf">5</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Cells</span> <span class="o">=</span> <span class="p">{</span><span class="mf">5</span><span class="p">:</span><span class="n">E2V</span><span class="p">,</span><span class="mf">3</span><span class="p">:</span><span class="n">E2edge</span><span class="p">,</span><span class="mf">1</span><span class="p">:</span><span class="n">E2point</span><span class="p">}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pdata</span><span class="o">=</span><span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mf">12</span><span class="p">,</span><span class="mf">2</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pvdata</span><span class="o">=</span><span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mf">12</span><span class="o">*</span><span class="mf">3</span><span class="p">,</span><span class="mf">2</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cdata</span><span class="o">=</span><span class="p">{</span><span class="mf">5</span><span class="p">:</span><span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mf">12</span><span class="p">,</span><span class="mf">2</span><span class="p">)),</span><span class="mf">3</span><span class="p">:</span><span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mf">1</span><span class="p">,</span><span class="mf">2</span><span class="p">)),</span><span class="mf">1</span><span class="p">:</span><span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mf">4</span><span class="p">,</span><span class="mf">2</span><span class="p">))}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cvdata</span><span class="o">=</span><span class="p">{</span><span class="mf">5</span><span class="p">:</span><span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mf">3</span><span class="o">*</span><span class="mf">12</span><span class="p">,</span><span class="mf">2</span><span class="p">)),</span><span class="mf">3</span><span class="p">:</span><span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mf">3</span><span class="o">*</span><span class="mf">1</span><span class="p">,</span><span class="mf">2</span><span class="p">)),</span><span class="mf">1</span><span class="p">:</span><span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mf">3</span><span class="o">*</span><span class="mf">4</span><span class="p">,</span><span class="mf">2</span><span class="p">))}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">write_vtu</span><span class="p">(</span><span class="n">Verts</span><span class="o">=</span><span class="n">Verts</span><span class="p">,</span> <span class="n">Cells</span><span class="o">=</span><span class="n">Cells</span><span class="p">,</span> <span class="n">fname</span><span class="o">=</span><span class="s">&#39;test.vtu&#39;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="pyamg.vis.vtk_writer.write_basic_mesh">
<!--[pyamg.vis.vtk_writer.write_basic_mesh]--><tt class="descclassname">pyamg.vis.vtk_writer.</tt><tt class="descname">write_basic_mesh</tt><big>(</big><em>Verts</em>, <em>E2V=None</em>, <em>mesh_type='tri'</em>, <em>pdata=None</em>, <em>pvdata=None</em>, <em>cdata=None</em>, <em>cvdata=None</em>, <em>fname='output.vtk'</em><big>)</big><a class="headerlink" href="#pyamg.vis.vtk_writer.write_basic_mesh" title="Permalink to this definition">¶</a></dt>
<dd><p>Write mesh file for basic types of elements</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>fname</strong> : {string}</p>
<blockquote>
<p>file to be written, e.g. &#8216;mymesh.vtu&#8217;</p>
</blockquote>
<p><strong>Verts</strong> : {array}</p>
<blockquote>
<p>coordinate array (N x D)</p>
</blockquote>
<p><strong>E2V</strong> : {array}</p>
<blockquote>
<p>element index array (Nel x Nelnodes)</p>
</blockquote>
<p><strong>mesh_type</strong> : {string}</p>
<blockquote>
<p>type of elements: tri, quad, tet, hex (all 3d)</p>
</blockquote>
<p><strong>pdata</strong> : {array}</p>
<blockquote>
<p>scalar data on vertices (N x Nfields)</p>
</blockquote>
<p><strong>pvdata</strong> : {array}</p>
<blockquote>
<p>vector data on vertices (3*Nfields x N)</p>
</blockquote>
<p><strong>cdata</strong> : {array}</p>
<blockquote>
<p>scalar data on cells (Nfields x Nel)</p>
</blockquote>
<p><strong>cvdata</strong> : {array}</p>
<blockquote>
<p>vector data on cells (3*Nfields x Nel)</p>
</blockquote>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><strong>writes a .vtu file for use in Paraview</strong> :</p>
</td>
</tr>
</tbody>
</table>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a title="pyamg.vis.vtk_writer.write_vtu" class="reference" href="#pyamg.vis.vtk_writer.write_vtu"><tt class="xref docutils literal"><span class="pre">write_vtu</span></tt></a></p>
</div>
<p class="rubric">Notes</p>
<p>The difference between write_basic_mesh and write_vtu is that write_vtu is
more general and requires dictionaries of cell information.
write_basic_mesh calls write_vtu</p>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">import</span> <span class="nn">numpy</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Verts</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mf">0.0</span><span class="p">,</span><span class="mf">0.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">1.0</span><span class="p">,</span><span class="mf">0.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">2.0</span><span class="p">,</span><span class="mf">0.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">0.0</span><span class="p">,</span><span class="mf">1.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">1.0</span><span class="p">,</span><span class="mf">1.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">2.0</span><span class="p">,</span><span class="mf">1.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">0.0</span><span class="p">,</span><span class="mf">2.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">1.0</span><span class="p">,</span><span class="mf">2.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">2.0</span><span class="p">,</span><span class="mf">2.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">0.0</span><span class="p">,</span><span class="mf">3.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">1.0</span><span class="p">,</span><span class="mf">3.0</span><span class="p">],</span>
<span class="gp">... </span>                     <span class="p">[</span><span class="mf">2.0</span><span class="p">,</span><span class="mf">3.0</span><span class="p">]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">E2V</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mf">0</span><span class="p">,</span><span class="mf">4</span><span class="p">,</span><span class="mf">3</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">0</span><span class="p">,</span><span class="mf">1</span><span class="p">,</span><span class="mf">4</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">1</span><span class="p">,</span><span class="mf">5</span><span class="p">,</span><span class="mf">4</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">1</span><span class="p">,</span><span class="mf">2</span><span class="p">,</span><span class="mf">5</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">3</span><span class="p">,</span><span class="mf">7</span><span class="p">,</span><span class="mf">6</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">3</span><span class="p">,</span><span class="mf">4</span><span class="p">,</span><span class="mf">7</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">4</span><span class="p">,</span><span class="mf">8</span><span class="p">,</span><span class="mf">7</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">4</span><span class="p">,</span><span class="mf">5</span><span class="p">,</span><span class="mf">8</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">6</span><span class="p">,</span><span class="mf">10</span><span class="p">,</span><span class="mf">9</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">6</span><span class="p">,</span><span class="mf">7</span><span class="p">,</span><span class="mf">10</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">7</span><span class="p">,</span><span class="mf">11</span><span class="p">,</span><span class="mf">10</span><span class="p">],</span>
<span class="gp">... </span>                   <span class="p">[</span><span class="mf">7</span><span class="p">,</span><span class="mf">8</span><span class="p">,</span><span class="mf">11</span><span class="p">]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pdata</span><span class="o">=</span><span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mf">12</span><span class="p">,</span><span class="mf">2</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pvdata</span><span class="o">=</span><span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mf">12</span><span class="o">*</span><span class="mf">3</span><span class="p">,</span><span class="mf">2</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cdata</span><span class="o">=</span><span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mf">12</span><span class="p">,</span><span class="mf">2</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cvdata</span><span class="o">=</span><span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mf">3</span><span class="o">*</span><span class="mf">12</span><span class="p">,</span><span class="mf">2</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">write_basic_mesh</span><span class="p">(</span><span class="n">Verts</span><span class="p">,</span> <span class="n">E2V</span><span class="o">=</span><span class="n">E2V</span><span class="p">,</span> <span class="n">mesh_type</span><span class="o">=</span><span class="s">&#39;tri&#39;</span><span class="p">,</span><span class="n">pdata</span><span class="o">=</span><span class="n">pdata</span><span class="p">,</span> <span class="n">pvdata</span><span class="o">=</span><span class="n">pvdata</span><span class="p">,</span> <span class="n">cdata</span><span class="o">=</span><span class="n">cdata</span><span class="p">,</span> <span class="n">cvdata</span><span class="o">=</span><span class="n">cvdata</span><span class="p">,</span> <span class="n">fname</span><span class="o">=</span><span class="s">&#39;test.vtu&#39;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="index.html">
              <img class="logo" src="_static/logo_dropshadow_small.png" alt="Logo"/>
            </a></p>
            <h3><a href="index.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference" href="">Vis Documentation</a><ul>
<li><a class="reference" href="#module-pyamg.vis.vis_coarse">The <tt class="docutils literal"><span class="pre">vis_coarse</span></tt> Module</a></li>
<li><a class="reference" href="#module-pyamg.vis.setup">The <tt class="docutils literal"><span class="pre">setup</span></tt> Module</a></li>
<li><a class="reference" href="#module-pyamg.vis.vtk_writer">The <tt class="docutils literal"><span class="pre">vtk_writer</span></tt> Module</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="pyamg.html" title="previous chapter">Pyamg Documentation</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="pyamg.krylov.html" title="next chapter">Krylov Documentation</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="_sources/pyamg.vis.txt">Show Source</a></li>
            </ul>
          <h3>Quick search</h3>
            <form class="search" action="search.html" method="get">
              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
              <input type="hidden" name="check_keywords" value="yes" />
              <input type="hidden" name="area" value="default" />
            </form>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="pyamg.krylov.html" title="Krylov Documentation"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="pyamg.html" title="Pyamg Documentation"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">PyAMG v1.0 documentation</a> &raquo;</li>
          <li><a href="modules.html" accesskey="U">Project Documentation</a> &raquo;</li>
          <li><a href="pyamg.html" accesskey="U">Pyamg Documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2009, Nathan Bell, Luke Olson, Jacob Schroder.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.1.
    </div>
  </body>
</html>